package com.deduction.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.base.common.persistence.Page;
import com.company.model.CompanyProject;
import com.deduction.model.ProjectExternalEmployee;
import com.deduction.service.ProjectExternalEmployeeService;

@Controller
public class ProjectExternalEmployeeController {
	// 页面actionView的地址
	public static final String toExternalView = "/deduction/external";
	public static final String externalList = "/deduction/external/list";
	public static final String externalEdit = "/deduction/external/edit";
	public static final String externalDelete = "/deduction/external/delete";

	// 页面路径
	public static final String externalPage = "/deduction/external";
	
	
	@Autowired
	ProjectExternalEmployeeService projectExternalEmployeeService;
	
	@RequestMapping(value = toExternalView, method = RequestMethod.POST)
	public ModelAndView toExternalView() {
		ModelAndView mv = new ModelAndView(externalPage);
		return mv;
	}
	
	@ResponseBody
	@RequestMapping(value = externalList, method = RequestMethod.POST)
	public Page externalList(HttpServletRequest req, HttpServletResponse res,
			Page page, String projectId) {
		try {
			page = projectExternalEmployeeService.findProjectExternalPageByProjectId(projectId, page);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return page;
	}
	
}
